package com.example.back.mapper;

import com.example.back.entity.Chat;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface ChatMapper {
    @Insert("insert into chat(fszId,jszId,text,time) values(#{fszId},#{jszId},#{text},#{time})")
    int addChat(Chat chat);
    @Delete("delete from chat where id=#{param1}")
    int deleteChat(Integer id);
    @Update("update chat set fszId=#{fszId},jszId=#{jszId},text=#{text},time=#{time} where id=#{id}")
    int updateChat(Chat chat);
    @Select("select * from chat where id= #{param1}")
    Chat queryChatById(Integer id);
    @Select("select * from chat where fszId= #{param1} or jszId= #{param1}")
    ArrayList<Chat> queryChat(Chat chat);
    @Select("SELECT * FROM chat WHERE fszId=#{fszId} and jszId=#{jszId}")
    ArrayList<Chat> queryChatText(Integer fszId, Integer jszId);

}
